package com.hnkywl.sts.action.report;

import com.hnkywl.sts.service.report.YqyskService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Calendar;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: ccr
 * Date: 13-7-16
 * Time: 下午2:19
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/report/yqysk")
public class YqyskAction extends SimpleActionSupport{
    private YqyskService yqyskService;
    private Date startDate;
    private Date endDate;
    private Long gsId;
    private Long bmId;

    @Action("yqysk")
    public String yqysk(){
        Calendar c = Calendar.getInstance();
        c.set(Calendar.DATE,1);
        endDate = new Date();
        startDate = c.getTime();
        return SUCCESS;
    }

    @Action("yqyskList")
    public void yqyskList(){
        renderJson(yqyskService.yqyskList(gsId,bmId,startDate,endDate));
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Long getGsId() {
        return gsId;
    }

    public void setGsId(Long gsId) {
        this.gsId = gsId;
    }

    public Long getBmId() {
        return bmId;
    }

    public void setBmId(Long bmId) {
        this.bmId = bmId;
    }

    @Autowired
    public void setYqyskService(YqyskService yqyskService) {
        this.yqyskService = yqyskService;
    }
}
